const template = article => {
    return `
        <a href="/">首页</a> -
        <a href="/recommendation">更多文章推荐</a>
        <h1>${article.name}</h1>
        <span>${article.content} </span>
                `;
};

class WebpackArticle extends HTMLElement {
    connectedCallback() {
        this.innerHTML = template({name: "webpack", content: "webpack"});
    }
}
window.customElements.define(
    "webpack-article",
    WebpackArticle
);

class ReactArticle extends HTMLElement {
    connectedCallback() {
        this.innerHTML = template( {name: "react", content: "react"});
    }
}
window.customElements.define(
    "react-article",
    ReactArticle
);

class MfArticle extends HTMLElement {
    connectedCallback() {
        this.innerHTML = template({name: "micro-frontend", content: "micro-frontend"});
    }
}
window.customElements.define(
    "mf-article",
    MfArticle
);